# -*- coding: utf-8 -*-
'''
Created on 2012-9-23

@author: bbg
'''

from service.webside.shop_config_service import ShopConfigService
from dbwrapper.shopx.config_floor import ConfigFloor
import cgi

def start_response(a, b):
    pass

def shopConfigServiceSetTest():
    shopConfigService = ShopConfigService(start_response)
    #模拟cgi环境变量传进来的参数

    env = {} 
    env['QUERY_STRING'] = 'cmd=add&company_id=1&shop_id=1&op_shop_id=1&username=wxr'
    '&token=140M4-J8P3Y-NZNNL-2%EEI&floor_name=tiantan&rann_id=1'
    params = cgi.FieldStorage(environ = env) 
    table_class = ConfigFloor
    shopConfigService.setConfigAction(params, table_class)
    
    env['QUERY_STRING'] = 'cmd=update&company_id=1&shop_id=1&op_shop_id=1&username=wxr'
    '&token=140M4-J8P3Y-NZNNL-2%EEI&floor_name=beijing&rann_id=1&where_name=floor_name&where_value=tiantan'
    params = cgi.FieldStorage(environ = env) 
    shopConfigService.setConfigAction(params, table_class)
    
    env['QUERY_STRING'] = 'cmd=del&where_name=floor_name&where_value=beijing'
    params = cgi.FieldStorage(environ = env)    
    shopConfigService.setConfigAction(params, table_class)

def shopConfigServiceGetTest():
    pass

if __name__ == '__main__':
    shopConfigServiceSetTest()
    shopConfigServiceGetTest()